<template>
  <el-dialog
    class="previewForm"
    title="预览"
    :visible.sync="dialog.visible"
    :append-to-body="true"
    top="0vh"
    width="100%"
  >
    <ve-form-builder v-model="formData" :config="formConfig" />
  </el-dialog>
</template>
<script>
import { objectFormat } from "@/utils/tools";
export default {
  name: "PreviewForm",
  data() {
    return {
      formConfig: {},
      formData: {},
      // full OR dialog
      type: "full",
      dialog: {
        visible: false,
      },
    };
  },
  methods: {
    show(type, data) {
      this.formConfig = objectFormat(data);
      this.type = type;
      this.dialog.visible = true;
    },
    hide() {
      this.dialog.visible = false;
    },
  },
};
</script>
<style lang="scss" scoped>
.previewForm {
  margin-right: -6px;
  ::v-deep {
    .el-dialog {
      height: 100%;
      border-radius: 0;
    }
    .el-dialog__body {
      padding: 20px;
      min-height: 100%;
      background-color: #fff;
    }
  }
}
</style>
